import logger from "../../utils/logger";

class RetInner {
    constructor(code = 200, data = "", msg = "请求成功！") {
        this.code = code;
        this.data = data;
        this.msg = msg;
    }
    setData(data) {
        this.data = data;
        return this;
    }
    setMsg(msg) {
        this.msg = msg;
        return this;
    }

    valueOf() {
        return JSON.stringify(this);
    }
}

function Ret(code) {
    return new RetInner(code);
}


export default Ret;
export const RetCode = {
    SUCCESS: 200,
    ERROR: 500
}
const SUCCESS = 200;
const ERROR = 200;
export {
    SUCCESS,
    ERROR
}